package com.fastloan.mgt.product.label.service.impl;

import com.fastloan.common.BasicServiceImpl;
import com.fastloan.mgt.product.label.dao.LabelMapper;
import com.fastloan.mgt.product.label.service.LabelService;
import com.fastloan.mgt.product.label.model.Label;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

import static java.util.stream.Collectors.toList;

/**
 * @author admins
 *         createTime 2017/12/27
 */
@Service
public class LabelServiceImpl extends BasicServiceImpl<Label> implements LabelService {
    @Autowired
    private LabelMapper labelMapper;

    @Override
    public List<Label> queryByProductId(String productId) {
        return labelMapper.queryByProductId(productId);
    }

    @Override
    public List<Label> queryByIdS(String ids) {
        return Arrays.stream(ids.split(","))
                .map(this::selectByPrimaryKey)
                .collect(toList());
    }
}
